﻿<local:StructViewBase 
    x:Class="AdminModule.UserControls.StructView.UniversityStruct"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:common="clr-namespace:System.Windows;assembly=System.Windows.Controls"
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:classes="clr-namespace:AdminModule.CustomXAMLElements"
    xmlns:sharedCode="clr-namespace:SharedCode;assembly=SharedCode"
    xmlns:converters="clr-namespace:AdminModule.Converters"
    xmlns:validation="clr-namespace:InpValidator"
    xmlns:vm="clr-namespace:AdminModule.ViewModels"
    xmlns:local="clr-namespace:AdminModule.UserControls.StructView">

    <local:StructViewBase.Resources>
        <vm:CommonVM2 x:Key="commonVM"></vm:CommonVM2>
        <converters:BoolToVisibilityConverter x:Key="boolToVisibilityConverter"></converters:BoolToVisibilityConverter>
        
        <common:HierarchicalDataTemplate x:Key="DepartmentLevel1" ItemsSource="{Binding Path=Childs2, Mode=TwoWay}">

            <classes:TemplateSelector Content="{Binding}">
                <classes:TemplateSelector.Templates>

                    <classes:IMDataTemplate IMName="AdmBaseClass">
                        <StackPanel Visibility="{Binding IsVisibility, Converter={StaticResource boolToVisibilityConverter}, Mode=TwoWay}" />
                    </classes:IMDataTemplate>

                    <classes:IMDataTemplate IMName="AdmRespondent">
                        <StackPanel Orientation="Horizontal">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock FontStyle="Italic" Padding="0" Text="{Binding Order}" />
                                <TextBlock FontStyle="Italic" Padding="0" Text=". " />
                                <TextBlock FontStyle="Italic" Padding="0" Text="{Binding Path=Person.LastName}" />
                                <TextBlock FontStyle="Italic" Padding="0" Text=" " />
                                <TextBlock FontStyle="Italic" Padding="0" Text="{Binding Path=Person.FirstName}" />
                                <TextBlock FontStyle="Italic" Padding="0" Text=" " />
                                <TextBlock FontStyle="Italic" Padding="0" Text="{Binding Path=Person.Patronymic}" />

                                <ToolTipService.ToolTip>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="IDRespondent: "></TextBlock>
                                        <TextBlock Text="{Binding IDRespondent}"></TextBlock>
                                        <TextBlock Text=", "></TextBlock>
                                        <TextBlock Text="IDPerson: "></TextBlock>
                                        <TextBlock Text="{Binding Path=Person.IDPerson}"></TextBlock>
                                    </StackPanel>
                                </ToolTipService.ToolTip>
                            </StackPanel>
                            <ComboBox Margin="5,0,0,0" Background="{x:Null}" BorderThickness="1" BorderBrush="#ffd9d9d9" Tag="{Binding}" ItemsSource="{Binding AdmJobCollection, Source={StaticResource commonVM}, Mode=TwoWay}" x:Name="jobComboBox" SelectionChanged="jobComboBox_SelectionChanged" Loaded="jobComboBox_Loaded">
                                <ComboBox.ItemTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="{Binding Path=Position.Name}"></TextBlock>
                                            <TextBlock Text=" - "></TextBlock>
                                            <TextBlock Text="{Binding Path=Status.Order}"></TextBlock>
                                            <TextBlock Text=" ст."></TextBlock>
                                            
                                            <ToolTipService.ToolTip>
                                                <StackPanel Orientation="Horizontal">
                                                    <TextBlock Text="IDJob: "></TextBlock>
                                                    <TextBlock Text="{Binding IDJob}"></TextBlock>
                                                    <TextBlock Text=", "></TextBlock>
                                                    <TextBlock Text="IDPosition: "></TextBlock>
                                                    <TextBlock Text="{Binding Path=Position.IDPosition}"></TextBlock>
                                                    <TextBlock Text=", "></TextBlock>
                                                    <TextBlock Text="IDStatus: "></TextBlock>
                                                    <TextBlock Text="{Binding Path=Status.IDStatus}"></TextBlock>
                                                </StackPanel>
                                            </ToolTipService.ToolTip>
                                        </StackPanel>
                                    </DataTemplate>
                                </ComboBox.ItemTemplate>
                                <validation:ValidatorService.Validator>
                                    <validation:ComboBoxNotNullValidator Init="InitValidator" />
                                </validation:ValidatorService.Validator>
                            </ComboBox>
                            <CheckBox Margin="5,0,0,0" ToolTipService.ToolTip="Основная работа" IsChecked="{Binding Path=FlagOsnJob, Mode=TwoWay}" />
                            <CheckBox Margin="5,0,0,0" ToolTipService.ToolTip="Не участвует в расчете индексов" IsChecked="{Binding Path=IgnoreVolumes, Mode=TwoWay}" />
                            <CheckBox Margin="5,0,0,0" ToolTipService.ToolTip="Уволен" IsChecked="{Binding Path=Dismissed, Mode=TwoWay}" />
                        </StackPanel>
                    </classes:IMDataTemplate>

                    <classes:IMDataTemplate IMName="AdmDepartment">
                        <StackPanel Orientation="Horizontal">
                            <!--<TextBlock Padding="0" Text="{Binding Path=Name, Mode=TwoWay}" />-->
                            <TextBlock Padding="0" Text="{Binding Path=FullName, Mode=TwoWay}" />
                            <TextBlock Text=" (" />
                            <TextBlock Padding="0" Text="{Binding Path=Abbriviation, Mode=TwoWay}" />
                            <TextBlock Text=")" />

                            <ToolTipService.ToolTip>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="IDDepartmentTerm: "></TextBlock>
                                    <TextBlock Text="{Binding IDDepartmentTerm}"></TextBlock>
                                    <TextBlock Text=", "></TextBlock>
                                    <TextBlock Text="IDDepartment: "></TextBlock>
                                    <TextBlock Text="{Binding IDDepartment}"></TextBlock>
                                </StackPanel>
                            </ToolTipService.ToolTip>
                        </StackPanel>
                    </classes:IMDataTemplate>

                </classes:TemplateSelector.Templates>
            </classes:TemplateSelector>

        </common:HierarchicalDataTemplate>

        <common:HierarchicalDataTemplate x:Key="DepartmentRootLevel" ItemsSource ="{Binding Path=Childs2, Mode=TwoWay}" ItemTemplate="{StaticResource DepartmentLevel1}">
            <StackPanel Orientation="Horizontal">
                <TextBlock Loaded="rootNode_Loaded" x:Name="rootNode" Text="{Binding Path=Name, Mode=TwoWay}" FontWeight="Bold" />
            </StackPanel>
        </common:HierarchicalDataTemplate>
    </local:StructViewBase.Resources>

</local:StructViewBase>
